//
//  ViewController.m
//  iOS尺子控件
//
//  Created by JH on 2017/4/18.
//  Copyright © 2017年 JH. All rights reserved.
//

#import "ViewController.h"
#import "JHRulerView.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 400, 0, 50)];
    label.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:label];

    JHRulerView *oneRulerView = [[JHRulerView alloc] initWithFrame:CGRectMake(300, 0, 80, CGRectGetHeight([UIScreen mainScreen].bounds)) rulerShowType:rulerViewshowVerticalType];
//    JHRulerView *oneRulerView = [[JHRulerView alloc] initWithFrame:CGRectMake(0, 100, CGRectGetWidth([UIScreen mainScreen].bounds), 60) rulerShowType:rulerViewshowHorizontalType];

    

    oneRulerView.rulerStyle.minValue = -200;
    oneRulerView.rulerStyle.maxValue = 400;

    oneRulerView.rulerType = JHRulerTypePicker;
    oneRulerView.rulerStyle.defaultVaule = 40;
//    oneRulerView.rulerStyle.accuracy = 0.5;
//    oneRulerView.rulerStyle.spacing = 15;

    oneRulerView.rulerStyle.stopOnTheLine = YES;
    oneRulerView.rulerStyle.lineColor = [UIColor orangeColor];
    oneRulerView.rulerStyle.markViewSize = CGSizeMake(8, 16);

    oneRulerView.valueChangeCallback = ^(CGFloat currentValue) {
        label.text = [NSString stringWithFormat:@"ruler one :%.0f",currentValue];
                [label sizeToFit];
    };
//        [oneRulerView reloadData];
    [self.view addSubview:oneRulerView];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
